package com.smh.a01CollectionDemo1;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionDemo2 {
    public static void main(String[] args) {

        Student student = new Student("asd",12,"nan");
        Student student2 = new Student("asd",12,"nan");
        Student student3 = new Student("asd",12,"nan");

        Collection<Student> c = new ArrayList<>();
        c.add(student);
        c.add(student2);
        c.add(student3);
        //contains调用了Objects的equals方法,所以,你要重写方法,否则就是比较地址.
        //string比较,java在底层已经帮我们重写了equals方法.
        System.out.println(c.contains(student));
        System.out.println(c.size());
        System.out.println(c.isEmpty());


    }
}
